package com.carlinfo.userscenter.stu.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.carlinfo.common.util.DateUtil;
import com.carlinfo.common.util.NumberUtil;

/**
 * 学生信息pojo
 * @author 90711
 *  sex 性别 true:男,false:女
 *  accuracy 正确率
 *  todayAccuracy 今日正确率
 *  countTrue 正确次数
 *  countFalse 错误次数
 */
public class Students implements Serializable{
	private int id;
	private String name;
	private String sex;
	private Date birth;
	private String graduateSchool;
	private double score;
	private int totalCount;
	private int countTrue;
	private int countFalse;
	private double accuracy;
	private int todayCount;
	private int todayTrueCount;
	private int todayFalseCount;
	private double todayAccuracy;
	private int levelId;
	private Date createTime;
	private Date updateTime;
	private Level level;
	private Date pubTime;
	private String context;
	private byte status;
	
	/* 定义状态的字符串 */
	private String statusStr;
	private Map<String, ADynastyEnum> statusMap;
	
	/* id,姓名,身高,创建时间,更新时间,爱好 */
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public Date getBirth() {
		return birth;
	}
	public void setBirth(Date birth) {
		this.birth = birth;
	}
	public String getGraduateSchool() {
		return graduateSchool;
	}
	public void setGraduateSchool(String graduateSchool) {
		this.graduateSchool = graduateSchool;
	}
	public Level getLevel() {
		return level;
	}
	public void setLevel(Level level) {
		this.level = level;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int d) {
		this.totalCount = d;
	}
	public int getCountTrue() {
		return countTrue;
	}
	public void setCountTrue(int conutTrue) {
		this.countTrue = conutTrue;
	}
	public int getCountFalse() {
		return countFalse;
	}
	public void setCountFalse(int countFalse) {
		this.countFalse = countFalse;
	}
	public double getAccuracy() {
		return accuracy;
	}
	public void setAccuracy(double accuracy) {
		this.accuracy = accuracy;
	}
	public int getTodayCount() {
		return todayCount;
	}
	public void setTodayCount(int d) {
		this.todayCount = d;
	}
	public int getTodayTrueCount() {
		return todayTrueCount;
	}
	public void setTodayTrueCount(int d) {
		this.todayTrueCount = d;
	}
	public int getTodayFalseCount() {
		return todayFalseCount;
	}
	public void setTodayFalseCount(int todayFalseCount) {
		this.todayFalseCount = todayFalseCount;
	}
	
	/* id,姓名,性别,生日,毕业院校,分数, 总次数，正确次数，错误次数，正确率，今日次数，今日答对，今日答错，今日正确率，创建时间，更新时间*/
	@Override
	public String toString() {
		String dengji = "无";
		if(getLevel()!=null) {
			dengji = getLevel().getName();
		}
		NumberUtil numberUtil = new NumberUtil();
		DateUtil dateUtil = new DateUtil();
		return getId()+"\t"+getName()+"\t"+getSex()+"\t"+
				dateUtil.dateToStr(getBirth())+"\t"+
				getGraduateSchool()+"\t\t"+
				getScore()+"\t"+
				dengji+"\t"+
				getTotalCount()+"\t"+
				getCountTrue()+"\t"+
				getCountFalse()+"\t"+
				numberUtil.numberToStr(getAccuracy())+"\t"+getTodayTrueCount()+"\t"+getTodayFalseCount()+"\t"+
				getTodayCount()+"\t\t"+
				numberUtil.numberToStr(getTodayAccuracy())+"\t\t"+
				dateUtil.dateTimeToStr(getCreateTime())+"\t"+
				dateUtil.dateTimeToStr(getUpdateTime());
	}
	public double getTodayAccuracy() {
		return todayAccuracy;
	}
	public void setTodayAccuracy(double todayAccuracy) {
		this.todayAccuracy = todayAccuracy;
	}
	public double getScore()
	{
		return score;
	}
	public void setScore(double score)
	{
		this.score = score;
	}
	public int getLevelId()
	{
		return levelId;
	}
	public void setLevelId(int levelId)
	{
		this.levelId = levelId;
	}
	public Date getPubTime()
	{
		return pubTime;
	}
	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}
	public byte getStatus()
	{
		return status;
	}
	public void setStatus(byte status)
	{
		this.status = status;
	}
	public String getContext()
	{
		return context;
	}
	public void setContext(String context)
	{
		this.context = context;
	}
	public String getStatusStr()
	{
		ADynastyEnum[] values = ADynastyEnum.values();
		for (ADynastyEnum enumTemp : values)
		{
			if(this.status==enumTemp.getValue() && enumTemp.toString().startsWith("STATUS_"))
			{
				this.statusStr = enumTemp.getInfo();
			}
		}
		return statusStr;
	}
	
	public Map<String, ADynastyEnum> getStatusMap()
	{
		this.statusMap= new TreeMap<String, ADynastyEnum>();
		ADynastyEnum[] values = ADynastyEnum.values();
		for (ADynastyEnum enumTemp : values)
		{
			if(enumTemp.toString().startsWith("STATUS_"))
			{
				this.statusMap.put(enumTemp.getValue()+"", enumTemp);
			}
		}
		return statusMap;
	}
	
}	
